<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head th:include="/common/commonHead :: commonHead('用户管理')"></head>
<body>
<div th:replace="/common/titleNav :: titleNavDiv"></div>
<div class="content" th:with="oneMenu='2',twoMenu='1'">
    <div th:replace="/common/sidebarNav :: sidebarDiv"></div>
    <div class="main">
        <div class="right">
            <ol class="breadcrumb" style="margin-top:15px;">
                <li><a th:href="@{/user/list}">用户管理</a></li>
                <li class="active">用户</li>
            </ol>
            <ul id="myTab" class="nav nav-tabs">
                <li class="active base">
                    <a href="#base" data-toggle="tab">
                        基本信息
                    </a>
                </li>

                <li class="roles" th:if="${entity?.id != null}">
                    <a href="#roles" data-toggle="tab">
                        角色
                    </a>
                </li>

                <li class="userGroup" th:if="${entity?.id != null}">
                    <a href="#userGroup" data-toggle="tab">
                        用户组
                    </a>
                </li>
            </ul>
            <div id="tabContent" class="tab-content">
                <div class="tab-pane active" id="base" th:include="/admin/user/tab_base :: base"></div>
                <div class="tab-pane" id="roles" th:if="${entity?.id != null}" th:include="/admin/user/tab_role :: role"></div>
                <div class="tab-pane" id="userGroup" th:if="${entity?.id != null}" th:include="/admin/user/tab_userGroup :: userGroup"></div>
            </div>
        </div>
    </div>
</div>

<form th:action="@{/user/edit}" method="post" id="tabForm">
    <input type="hidden" name="id" th:value="${entity?.id}"/>
    <input type="hidden" name="tab" value=""/>
    <input type="hidden" name="rPage" th:value="${userDto.rPage}"/>
    <input type="hidden" name="rRows" th:value="${userDto.rRows}"/>
    <input type="hidden" name="uPage" th:value="${userDto.uPage}"/>
    <input type="hidden" name="uRows" th:value="${userDto.uRows}"/>

    <input type="hidden" name="loginId" th:value="${param.loginId}"/>
    <input type="hidden" name="userName" th:value="${param.userName}"/>
    <input type="hidden" name="enabled" th:value="${param.enabled}"/>
    <input type="hidden" name="deptNumber" th:value="${param.deptNumber}"/>
    <input type="hidden" name="deptName" th:value="${param.deptName}"/>
    <input type="hidden" name="page" th:value="${param.page}"/>
    <input type="hidden" name="rows" th:value="${param.rows}"/>
</form>

<form th:action="@{/user/list}" method="post" id="backForm">
    <input type="hidden" name="loginId" th:value="${param.loginId}"/>
    <input type="hidden" name="userName" th:value="${param.userName}"/>
    <input type="hidden" name="enabled" th:value="${param.enabled}"/>
    <input type="hidden" name="deptNumber" th:value="${param.deptNumber}"/>
    <input type="hidden" name="deptName" th:value="${param.deptName}"/>
    <input type="hidden" name="page" th:value="${param.page}"/>
    <input type="hidden" name="rows" th:value="${param.rows}"/>
</form>

<!-- 模态框（Modal） -->
<div class="modal fade" id="addRole" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-dialog" style="width: 800px;">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
                <h4 class="modal-title">添加角色</h4>
            </div>
            <div class="modal-body">
                <div class="pop-search-list">
                    <div class="form-group">
                        <label class="control-label">角色名称：</label>
                        <input class="form-control s" type="text" id="name" placeholder="请输入"/>
                        <label class="control-label">角色描述：</label>
                        <input class="form-control s" type="text" id="description" placeholder="请输入"/>
                    </div>
                    <div class="btn-group-box">
                        <button type="button" class="btn btn-primary btn-sm" id="queryRole">查询</button>
                        <button type="button" class="btn btn-default border-blue btn-sm" id="resetRole">重置</button>
                    </div>
                </div>
                <div class="scroll-body">
                    <table class="table table-bordered table-hover table-condensed">
                        <thead>
                        <tr>
                            <th width="10%" class="left"><input type="checkbox" id="selectRoleListAll"/></th>
                            <th width="30%">角色名称</th>
                            <th width="40%">角色描述</th>
                            <th width="20%" class="right">状态</th>
                        </tr>
                        </thead>
                        <tbody id="roleTable">

                        </tbody>
                    </table>
                </div>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-primary" id="batchSave">确定</button>
                <button type="button" class="btn btn-default border-blue" data-dismiss="modal">取消</button>
            </div>
        </div><!-- /.modal-content -->
    </div><!-- /.modal-dialog -->
</div><!-- /.modal -->

<div class="modal fade" id="addUserGroup" tabindex="-1" role="dialog"  aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-dialog" style="width: 800px;">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
                <h4 class="modal-title" id="myModalLabel">添加用户组</h4>
            </div>
            <div class="modal-body">
                <div class="pop-search-list">
                    <div class="form-group">
                        <label class="control-label">用户组名称：</label>
                        <input class="form-control s" type="text" id="name" placeholder="请输入"/>
                        <label class="control-label">用户组描述：</label>
                        <input class="form-control s" type="text" id="description" placeholder="请输入"/>
                    </div>
                    <div class="btn-group-box">
                        <button type="button" class="btn btn-primary btn-sm" id="queryUserGroup">查询</button>
                        <button type="button" class="btn btn-default border-blue btn-sm" id="resetUserGroup">重置</button>
                    </div>
                </div>
                <div class="scroll-body">
                    <table class="table table-bordered table-hover table-condensed">
                        <thead>
                        <tr>
                            <th width="10%" class="left"><input type="checkbox" id="selectUserGroupListAll"/></th>
                            <th width="30%">用户组名称</th>
                            <th width="40%">用户组描述</th>
                            <th width="20%" class="right">状态</th>
                        </tr>
                        </thead>
                        <tbody id="userGroupTable">

                        </tbody>
                    </table>
                </div>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-primary" id="batchSaveUserGroup">确定</button>
                <button type="button" class="btn btn-default border-blue" data-dismiss="modal">取消</button>
            </div>
        </div><!-- /.modal-content -->
    </div><!-- /.modal-dialog -->
</div><!-- /.modal -->
<input type="hidden" th:value="${user.id}" id="userId">
<script type="text/javascript" th:src="@{/static/javascript/admin/user/edit.js}"></script>
</body>
</html>